Skip to main content
Version: 4.0

Description

@suplink/jssdk provides a series of SDKs which you can use to develop custom applications.

info

Applications used these SDKs must be running on supLink mobile.

Usage

  • Install denpendency
npm install @suplink/jssdk -S
  • Example
    • Full import
      import suplink from '@suplink/jssdk';
      suplink.getSystemInfo().then((res) => console.log(res))
    • Import as needed
      import { getSystemInfo } from '@suplink/jssdk';
      getSystemInfo().then((res) => console.log(res))
    • Import online resources
      // latest version of online resource
      <script src="https://devc.supos.com/suplink/jssdk/scripts/jssdk.min.js"></script>
      // specified version of online resource (jssdk-{version}.min.js)
      <script src="https://devc.supos.com/suplink/jssdk/scripts/jssdk-1.2.13.min.js"></script>
      <script type="text/javascript">
      window.suplink.getSystemInfo().then((res) => console.log(res))
      </script>

SDK Details-Basic

getEnvInfo

Definition
Get environment information.
Parameter
None
Response
AttributeTypeDescription
codestring200: Success | 404: Failure
msgstringResponse information
dataObjectResponse data
data.suplinkbooleanWhether it is running on supLink
data.iframebooleanWhether it is running on iframe
Example
import { getEnvInfo } from '@suplink/jssdk';
getEnvInfo().then((res) => console.log(res))

getSystemInfo

Definition
Get system information.
info
Parameter
None
Response
AttributeTypeDescription
codestring200: Success | 404: Failure
msgstringResponse information
dataDataResponse data
Attribute data description
AttributeTypeDescriptionAPP Version
brandstringDevice brand (e.g., HUAWEI, XIAOMI, iOS: Apple)
currentBatterystringDevice battery level
languagestringUser's preferred language
modelstringPhone model
pixelRationumberDevice pixel ratio (1 for Android. For iOS, it represents screen width pixels / screen width points.)
pixelWidthnumberDevice pixel width (For Android, it represents the width of the screen including virtual keys. For iOS, it represents the physical screen width in pixels, e.g., 1080.)
pixelHeightnumberDevice pixel height (For Android, it represents the height of the screen including virtual keys. For iOS, it represents the physical screen height in pixels, e.g., 1920.)
platformstringOperating system name: Android, iOS
storagestringDevice disk size
systemstringOperating system version number
statusBarHeightnumberStatus bar height (This value is in points. For pixel value, please multiply it with the pixel ratio.)
navigationBarHeightnumberNavigation bar height (This value is in points. For pixel value, please multiply it with the pixel ratio.)
webSourcenumberWebView opening method (0: Open normally from the homepage, 1: Open from im, 2: Open with jsapi)
deviceIdstringUnique device identifier
appVersionstringsuplinkAPP version3.3.0
suposServerVersionstringsupos backend version3.4.0
suplinkServerVersionstringsuplink backend version3.4.0
easyModebooleanEasy Mode4.3.0
highPerformancebooleanHigh Performance Mode4.3.0
darkModebooleanDark Mode4.3.0
info

currentBattery, storage and statusBarHeight are unavailable in h5.

Example
import { getSystemInfo } from '@suplink/jssdk';
getSystemInfo().then((res) => console.log(res))

renderFinish

Definition
Notice for finishing rendering (only for opening and closing native toast in flowchart).
Parameter
None
Response
AttributeTypeDescription
codestring200: Success | 404: Failure
msgstringResponse information
dataunknownResponse data
Example
import { renderFinish } from '@suplink/jssdk';
renderFinish().then((res) => console.log(res))

SDK Details-Device

biometrics

Definition
Biometrics.
Parameter
None
Response
AttributeTypeDescription
codestring200: Success | 404: Failure
msgstringResponse information
dataunknownResponse data
Example
import { biometrics } from '@suplink/jssdk';
biometrics().then((res) => console.log(res))

compass

Definition
Compass.
Parameter
None
Response
AttributeTypeDescription
codestring200: Success | 404: Failure
msgstringResponse information
dataunknownResponse data
Example
import { compass } from '@suplink/jssdk';
compass().then((res) => console.log(res))

connectPrinter

Definition
Connect printer.
Parameter
AttributeTypeDescriptionRequired
modenumberConnection mode: 0 for Bluetooth connection, 1 for WiFi connectionYes
hoststringHost address (IP + port) for WiFi printingNo
macstringMAC address of the printer for Bluetooth printingNo
Response
AttributeTypeDescription
codestring200: Success | 404: Failure
msgstringResponse information
dataunknownResponse data
Example
import { connectPrinter } from '@suplink/jssdk';
connectPrinter({ mode:1, host: '127.0.0.1:2020' }).then((res) => console.log(res))

disconnectPrinter

Definition
Disconnect printer.
info
  • Only Zebra printer is supported.
  • APP version must be v3.7.0 and later.
Parameter
None
Response
AttributeTypeDescription
codestring200: Success | 404: Failure
msgstringResponse information
dataunknownResponse data
Example
import { disconnectPrinter } from '@suplink/jssdk';
disconnectPrinter().then((res) => console.log(res))

flashlight

Definition
Flashlight.
Parameter
AttributeTypeDescriptionRequired
openbooleanWhether to turn on the flashlight.Yes
Response
AttributeTypeDescription
codestring200: Success | 404: Failure
msgstringResponse information
dataunknownResponse data
Example
import { flashlight } from '@suplink/jssdk';
flashlight({ open: true }).then((res) => console.log(res))

gesture

Definition
Gesture.
Parameter
None.
Response
AttributeTypeDescription
codestringResponse code: 200 for successful gesture verification, 300 for user canceling gesture verification, 404 for failure
msgstringResponse information
dataunknownResponse data
Example
import { gesture } from '@suplink/jssdk';
gesture().then((res) => console.log(res))

getBluetoothPairedDevices

Definition
Get devices paired through bluetooth.
info
  • Only Android is supported.
  • APP version must be v3.7.0 and later.
Parameter
None
Response
AttributeTypeDescription
codestringResponse code: 200 for success, 404 for failure
msgstringResponse information
dataObjectResponse data
data.listArray.<Device>Response data list containing Device objects
Array.<Device> description
AttributeTypeDescription
namestringDevice name
addressstringDevice address used for sending print commands
Example
import { getBluetoothPairedDevices } from '@suplink/jssdk';
getBluetoothPairedDevices().then((res) => console.log(res))

getNetworkInfo

Definition
Get network status.
Parameter
None
Response
AttributeTypeDescription
codestringResponse code: 200 for success, 404 for failure
msgstringResponse information
dataObjectResponse data
data.networkAvailablebooleanIndicates whether the network is available
data.networkTypestringValue representing the network type
Example
import { getNetworkInfo } from '@suplink/jssdk';
getNetworkInfo().then((res) => console.log(res))

makePhoneCall

Definition
Make phone calls.
Parameter
AttributeTypeDescriptionRequired
phoneNumbernumber or stringUser's phone numberYes
Response
AttributeTypeDescription
codestringResponse code: 200 for success, 404 for failure
msgstringResponse information
dataunknownResponse data
Example
import { makePhoneCall } from '@suplink/jssdk';
makePhoneCall({ phoneNumber: 110 }).then((res) => console.log(res))

nfc

Definition
NFC function.
Parameter
AttributeTypeDescriptionDefaultRequired
typenumberNFC usage type: 0 for NFC verification, 1 for reading NFC data and returning it0No
Response
AttributeTypeDescription
codestringResponse code: 200 for success, 404 for failure
msgstringResponse information
datastringResponse data. If the data reading function is called, it returns specific data.
Example
import { nfc } from '@suplink/jssdk';
nfc({ type: 0 }).then((res) => console.log(res))

ocr

Definition
OCR function.
Parameter
None.
Response
AttributeTypeDescription
codestringResponse code: 200 for success, 404 for failure
msgstringResponse information
datastringResponse data
Example
import { ocr } from '@suplink/jssdk';
ocr().then((res) => console.log(res))

oncePrint

Definition
Print once.
info
  • Only Zebra printer and Android system are supported.
  • APP version must be v3.7.0 and later.
Parameter
AttributeTypeDescriptionRequired
modenumberConnection mode: 0 for Bluetooth connection, 1 for WiFi connectionYes
contentstringPrint content. If using CPCL language, newline must end with \nYes
hoststringHost address (IP + port) for WiFi printingNo
macstringMAC address of the printer for Bluetooth printingNo
Response
AttributeTypeDescription
codestringResponse code: 200 for success, 404 for failure
msgstringResponse information
dataunknownResponse data
Example
import { oncePrint } from '@suplink/jssdk';
oncePrint({ mode: 0, content: '123', host: '127.0.0.1:22' }).then((res) => console.log(res))

print

Definition
Print.
info
  • Only Zebra printer and Android system are supported.
  • APP version must be v3.7.0 and later.
  • The connection does not automatically disconnect after printing, unless disconnectPrinter is used.
Parameter
AttributeTypeDescriptionRequired
contentstringPrint content. If using CPCL language, newline must end with \nYes
Response
AttributeTypeDescription
codestringResponse code: 200 for success, 404 for failure
msgstringResponse information
dataunknownResponse data
Example
import { print } from '@suplink/jssdk';
print({ content: '123' }).then((res) => console.log(res))

scanCode

Definition
Scan codes.
Parameter
None.
Response
AttributeTypeDescription
codestringResponse code: 200 for success, 404 for failure
msgstringResponse information
dataunknownResponse data
Example
import { scanCode } from '@suplink/jssdk';
scanCode().then((res) => console.log(res))

scanner

Definition
Scanner.
info
  • Only Android is supported.
  • APP version must be v3.1.0 and later.
  • Manually set broadcast on Android. Name: com.bluetron.suplink.login, key: loginData.
Parameter
AttributeTypeDescriptionRequired
outputModenumberData output mode: 0 for return data mode (requires passing a second argument) | 1 for keyboard mode, directly filling the focused input box. Some devices may not support this mode.No
successfunctionCallback function to receive scanner dataNo
success({
code: 200, // response code. 200: success | 404: failed
msg: '', // response message
data: '', // scanned data
})
Response
AttributeTypeDescription
codestringResponse code: 200 for success, 404 for failure
msgstringResponse information
dataunknownResponse data
Example
import { scanner } from '@suplink/jssdk';
scanner({ outputMode: 1 }).then((res) => console.log(res))

setScreenOrientation

Definition
Set screen orientation.
Parameter
AttributeTypeDescriptionRequired
modestringRotation mode: 'auto' for automatic orientation | 'landscape' for landscape orientation | 'portrait' for portrait orientationYes
Response
AttributeTypeDescription
codestringResponse code: 200 for success, 404 for failure
msgstringResponse information
dataunknownResponse data
Example
import { setScreenOrientation } from '@suplink/jssdk';
setScreenOrientation({ mode: 'auto' }).then((res) => console.log(res))

startContinuousScan

Definition
Enable continuous code scanning.
info

APP version must be v3.7.0 and later.

Parameter
AttributeTypeDescriptionDefaultRequiredAPP Version
intervalnumberScanning time interval in milliseconds. Minimum value is 1000ms.1000No
vibratebooleanWhether to enable vibrationfalseNo4.1.0
positionpositionScanner position: 0 for top, 1 for middle0No4.6.0
successfunctionCallback function to receive scan dataYes
success({
code: 200, // response code. 200: success | 404: failed
msg: '', // response message
data: '', // scanned data
})
Response
AttributeTypeDescription
codestringResponse code: 200 for success, 404 for failure
msgstringResponse information
dataunknownResponse data
Example
import { startContinuousScan } from '@suplink/jssdk';
startContinuousScan({ success: (result) => console.log(result) }).then((res) => console.log(res))

stopContinuousScan

Definition
Disable continuous code scanning.
info
  • Only Android is supported.
  • APP version must be v3.7.0 and later.
Parameter
None.
Response
AttributeTypeDescription
codestringResponse code: 200 for success, 404 for failure
msgstringResponse information
dataunknownResponse data
Example
import { stopContinuousScan } from '@suplink/jssdk';
stopContinuousScan().then((res) => console.log(res))

vibrate

Definition
Enable phone vibration.
info

APP version must be v4.1.0 and later.

Parameter
None.
Response
AttributeTypeDescription
codestringResponse code: 200 for success, 404 for failure
msgstringResponse information
dataunknownResponse data
Example
import { vibrate } from '@suplink/jssdk';
vibrate().then((res) => console.log(res))

SDK Details-Event

offPageHide

Definition
Cancel the page hidden event listening.
info

When passing a listener, only the corresponding hidden event for that listener is canceled; otherwise, all page hidden events are canceled.

Parameter
AttributeTypeDescriptionRequired
listenerfunctionEvent listener functionNo
Response
None.
Example
import { offPageHide } from '@suplink/jssdk';
offPageHide()

offPageShow

Definition
Cancel the page visible event listening.
info

When passing a listener, only the corresponding visible event for that listener is canceled; otherwise, all page visible events are canceled.

Parameter
AttributeTypeDescriptionRequired
listenerfunctionEvent listener functionNo
Response
None.
Example
import { offPageShow } from '@suplink/jssdk';
offPageShow()

onAppHide

Definition
Listen for mini propgram closing or going into standby mode.
info
  • Only Android is supported.
  • APP version must be v4.0.2 and later.
Parameter
AttributeTypeDescriptionRequired
listenerfunctionEvent listener functionYes
Response
None.
Example
import { onAppHide } from '@suplink/jssdk';
onAppHide({ listener: () => console.log('hide') })

onAppShow

Definition
Listen for mini propgram starting or going into active mode.
info
  • Only Android is supported.
  • APP version must be v4.0.2 and later.
Parameter
AttributeTypeDescriptionRequired
listenerfunctionEvent listener functionYes
Response
None.
Example
import { onAppShow } from '@suplink/jssdk';
onAppShow({ listener: () => console.log('show') })

onPageHide

Definition
Listen for page hidden events.
Parameter
AttributeTypeDescriptionRequired
listenerfunctionEvent listener functionYes
Response
None.
Example
import { onPageHide } from '@suplink/jssdk';
onPageHide({ listener: () => console.log('hide') })

onPageShow

Definition
Listen for page visible events.
Parameter
AttributeTypeDescriptionRequired
listenerfunctionEvent listener functionYes
Response
None.
Example
import { onPageShow } from '@suplink/jssdk';
onPageShow({ listener: () => console.log('show') })

SDK Details-File

fileConverter

Definition
Convert file type.
info

APP version must be v4.3.0 and later.

Parameter
AttributeTypeDescriptionRequired
targetstringConverted file type: 'pdf' for PDF filesYes
urlsArray.<string>List of file URLs to be convertedYes
daysnumberStorage duration in days.
  • days <= 0: Permanent storage,
  • days > 0: Save for a specified number of days. Non-integer values will be rounded down.
No
Response
AttributeTypeDescription
codestringResponse code: 200 for success, 404 for failure
msgstringResponse information
dataObjectResponse data
data.filesArray.<File>List of converted files
Array.<File> description
AttributeTypeDescription
previewUrlstringFile preview URL
sourceFileUrlstringFile address
sizestringFile size
Example
import { fileConverter } from '@suplink/jssdk';
fileConverter({ target: 'pdf', urls: ['http://127.0.0.1/test.xls'] }).then((res) => console.log(res))

previewFile

Definition
Preview file.
info

Images, videos and PDF files are supported for preview.

Parameter
AttributeTypeDescriptionRequired
urlstringComplete path of the file to be previewedYes
titlestringName of the file to be previewedNo
Response
AttributeTypeDescription
codestringResponse code: 200 for success, 404 for failure
msgstringResponse information
dataunknownResponse data
Example
import { previewFile } from '@suplink/jssdk';
previewFile({ url: 'http://127.0.0.1/img/test.png' }).then((res) => console.log(res))

SDK Details-Position

getLocation

Definition
Get location.
info

APP version must be v4.3.0 and later.

Parameter
AttributeTypeDescriptionRequired
inverseEnabledbooleanEnable reverse geocoding to obtain more formatted information.
info

Reverse geocoding requires an internet connection.

No
Response
AttributeTypeDescription
codestringResponse code: 200 for success, 404 for failure
msgstringResponse information
dataDataResponse data
Data description
AttributeTypeDescription
longitudenumberLongitude
latitudenumberLatitude
horizontalAccuracynumberHorizontal accuracy, unit: meters
formattedAddressstringFormatted address (requires inverseEnabled=true)
countrystringCountry (requires inverseEnabled=true)
provincestringProvince/Direct-controlled Municipality (requires inverseEnabled=true)
citystringCity (requires inverseEnabled=true)
citycodestringCity code (requires inverseEnabled=true)
districtstringDistrict/County (requires inverseEnabled=true)
adcodestringArea code (requires inverseEnabled=true)
streetstringStreet name (requires inverseEnabled=true)
numberstringHouse number (requires inverseEnabled=true)
POINamestringPoint of Interest (POI) name (requires inverseEnabled=true)
AOINamestringArea of Interest (AOI) name (requires inverseEnabled=true)
Example
import { getLocation } from '@suplink/jssdk';
getLocation().then((res) => console.log(res))

startLocationUpdate

Definition
Enable real-time positioning.
Parameter
AttributeTypeDescriptionRequired
successfunctionCallback function to get real-time location dataYes
Response
AttributeTypeDescription
codestringResponse code: 200 for success, 404 for failure
msgstringResponse information
dataunknownResponse data
success({
code: 200, // response code. 200: success | 404: failed
msg: '', // response message
data: {
longitude: '',
latitude: '',
horizontalAccuracy: '', // unit: m
},
})
Example
import { startLocationUpdate } from '@suplink/jssdk';
startLocationUpdate({ success: (result) => console.log(result) }).then((res) => console.log(res))

stopLocationUpdate

Definition
Disable real-time positioning.
Parameter
None.
Response
AttributeTypeDescription
codestringResponse code: 200 for success, 404 for failure
msgstringResponse information
dataunknownResponse data
Example
import { stopLocationUpdate } from '@suplink/jssdk';
stopLocationUpdate().then((res) => console.log(res))

SDK Details-Media

playVoiceByText

Definition
Convert text to voice.
info

APP version must be v4.3.0 and later.

Parameter
AttributeTypeDescriptionRequired
textstringText to be convertedYes
Response
AttributeTypeDescription
codestringResponse code: 200 for success, 404 for failure
msgstringResponse information
dataDataResponse data
Example
import { playVoiceByText } from '@suplink/jssdk';
playVoiceByText({ text: 'Hello' }).then((res) => console.log(res))

previewImage

Definition
Preview images.
info
  • APP version must be v4.4.0 and later.
  • Switching preview between multiple images is available.
Parameter
AttributeTypeDescriptionRequired
urlsArray.<string>Complete paths of the imagesYes
indexnumberCurrent index of the image being displayedNo
Response
AttributeTypeDescription
codestringResponse code: 200 for success, 404 for failure
msgstringResponse information
dataDataResponse data
Example
import { previewImage } from '@suplink/jssdk';
previewImage({ urls: ['http://127.0.0.1/img/test.png'] }).then((res) => console.log(res))

record

Definition
Record voice.
Parameter
None.
Response
AttributeTypeDescription
codestringResponse code: 200 for success, 404 for failure
msgstringResponse information
dataObjectResponse data
data.voiceUrlstringPath to the audio recording file
Example
import { record } from '@suplink/jssdk';
record().then((res) => console.log(res))

SDK Details-Redirection

exitMiniProgram

Definition
Exit the current mini program.
Parameter
None.
Response
AttributeTypeDescription
codestringResponse code: 200 for success, 404 for failure
msgstringResponse information
dataUnknownResponse data
Example
import { exitMiniProgram } from '@suplink/jssdk';
exitMiniProgram().then((res) => console.log(res))

launchApp

Definition
Launch an application on mobile.
info

APP version must be v3.1.0 and later.

Parameter
AttributeTypeDescriptionRequired
androidstringSchema URL or package name for the Android appYes
iosstringSchema URL for the iOS appYes
messagestringError message when app launch is not successfulNo
Response
AttributeTypeDescription
codestringResponse code: 200 for success, 404 for failure
msgstringResponse information
dataUnknownResponse data
Example
import { launchApp } from '@suplink/jssdk';
launchApp({ android: 'suplink', ios: 'schemaDemo://' }).then((res) => console.log(res))

launchBaseMiniProgram

Definition
Launch a basic mini program on mobile.
Parameter
AttributeTypeDescriptionRequired
namestringBasic mini program name: alarm/trendYes
configAlarm | TrendConfiguration optionsYes
Alarm description
AttributeTypeDescriptionRequired
pageTypestringPage type: list for alarm list pageYes
objNamestringObject name of the tag, required when pageType=listNo
propNamestringProperty name of the tag, required when pageType=listNo
Trend description
AttributeTypeDescriptionRequired
pageTypestringPage type: detail for trend detail pageYes
objNamestringObject name of the tag, required when pageType=detailNo
propNamestringProperty name of the tag, required when pageType=detailNo
Response
AttributeTypeDescription
codestringResponse code: 200 for success, 404 for failure
msgstringResponse information
dataUnknownResponse data
Example
import { launchBaseMiniProgram } from '@suplink/jssdk';
launchBaseMiniProgram({
name: 'trend',
config: {
pageType: 'detail',
objName: 'test',
propName: 'testTAG0'
}
}).then((res) => console.log(res))

launchMiniProgram

Definition
Launch another mini program on mobile.
Parameter
AttributeTypeDescriptionRequired
appIdstringsupLink mini program's appIdYes
urlstringComplete URL path of the mini programYes
Response
AttributeTypeDescription
codestringResponse code: 200 for success, 404 for failure
msgstringResponse information
dataUnknownResponse data
Example
import { launchMiniProgram } from '@suplink/jssdk';
launchMiniProgram({ appId: 'abcd', url: 'www.baidu.com' }).then((res) => console.log(res))

SDK Details-Network

upload

Definition
Upload files.
info

APP version must be v3.1.4 and later.

Parameter
AttributeTypeDescriptionDefaultRequiredAPP Version
typenumber(Deprecated, use mode) Upload method: 0 for album and shooting, 1 for files, 2 for all2No
modenumber or Array.<number>Upload method, takes priority over type. 0 for album, 1 for shooting, 2 for filesNo3.9.0
maxnumberMaximum number of selections, negative number means no limit9No3.3.0
mediaTypenumberMedia types supported in the album, 0 for Photo + Video, 1 for Photo, 2 for Video0No
daysnumberStorage duration in days.
  • days <= 0: Permanent storage
  • days > 0: Save for a specified number of days. Non-integer values will be rounded down.
0No
Response
AttributeTypeDescription
codestringResponse code: 200 for success, 404 for failure
msgstringResponse information
dataObjectResponse data
data.filesArray.<Object>List of uploaded files
data.files[].previewUrlstringProcessed file preview path (e.g., compressed, cropped, format conversion, etc.)
data.files[].sourceFileUrlstringFile source path
data.files[].sizenumberFile size in bytes
Example
import { upload } from '@suplink/jssdk';
upload({ mode: 0 }).then((res) => console.log(res))

SDK Details-Open SDK

departmentSelector

Definition
Select departments.
Parameter
AttributeTypeDescriptionRequired
titlestringSelector titleNo
maxnumberMaximum number of selections allowed. If not passed or set to 0, it means unlimited.No
selectedArray.<string>Array of UUIDs of selected departmentsNo
selectedCodeArray.<string>Array of codes of selected departmentsNo
Response
AttributeTypeDescription
codestringResponse code: 200 for success, 404 for failure
msgstringResponse information
dataArray.<Department>Response data
Array.<Department> description
AttributeTypeDescription
uuidstringDepartment unique ID
showNamestringDepartment name
descriptionstringDepartment description
namestringsupOS current department number
parentstringsupOS parent department number
personsCountstringNumber of employees in the department
layNostringDepartment hierarchy
codestringDepartment code
Example
import { departmentSelector } from '@suplink/jssdk';
departmentSelector().then((res) => console.log(res))

employeeSelector

Definition
Select employees.
Parameter
AttributeTypeDescriptionDefaultRequired
typenumberSelector type: 1 for selecting without organizational structure, 2 for selecting with organizational structure1No
titlestringSelector titleempoyee selectorNo
maxnumberMaximum number of selections allowed. If not passed or set to 0, it means unlimited.No
selectedArray.<string>Array of staffCodes of selected personnelNo
Response
AttributeTypeDescription
codestringResponse code: 200 for success, 404 for failure
msgstringResponse information
dataArray.<Employee>Response data
Array.<Employee> description
AttributeTypeDescription
staffCodestringEmployee unique ID
phonestringPhone number
staffNamestringEmployee name
timeZonestringTime zone
emailstringEmail address
usernamestringAccount name
genderstringGender: 0 for female, 1 for male
portrailstringProfile picture
imUserJidstringCorresponding IM account
deptsstringDepartment list
userIdnumberEmployee ID
Example
import { employeeSelector } from '@suplink/jssdk';
employeeSelector().then((res) => console.log(res))

getLoginInfo

Definition
Get login information.
Parameter
AttributeTypeDescriptionDefaultRequired
typenumberSelector type: 1 for selecting without organizational structure, 2 for selecting with organizational structure1No
titlestringSelector titleempoyee selectorNo
maxnumberMaximum number of selections allowed. If not passed or set to 0, it means unlimited.No
selectedArray.<string>Array of staffCodes of selected personnelNo
Response
AttributeTypeDescription
codestringResponse code: 200 for success, 404 for failure
msgstringResponse information
dataDataResponse data
Data description
AttributeTypeDescription
tokennumbersuplink's token
userNamenumberUsername
appIdnumberApplication ID
baseUrlnumber-
appNamenumberApplication name
suposTokennumbersupOS token
info

For web apps, baseUrl is not available.

Example
import { getLoginInfo } from '@suplink/jssdk';
getLoginInfo().then((res) => console.log(res))

getStepCount

Definition
Get step count.
Parameter
None.
Response
AttributeTypeDescription
codestringResponse code: 200 for success, 404 for failure
msgstringResponse information
dataObjectResponse data
data.todayStepCountnumberToday's step count
Example
import { getStepCount } from '@suplink/jssdk';
getStepCount().then((res) => console.log(res))

getUserInfo

Definition
Get user information.
info

App version must V3.1.4 and later.

Parameter
None.
Response
AttributeTypeDescription
codestringResponse code: 200 for success, 404 for failure
msgstringResponse information
dataDataResponse data
Data description
AttributeTypeDescriptionAPP Version
supLinkTokenstringsupLink's Token
suposTokenstringsupOS's Token
suposTenantIdstringsupOS tenant ID
info

Unavailable for web apps.

suposTenantDnsstringsupOS tenant address4.1.0
userIdnumberUser ID
userCodestringUnique identifier for the user
usernamestringUsername
staffCodestringUnique identifier for the staff
staffNamestringStaff name
gendernumberGender: 0 for female, 1 for male
emailstringEmail address
phonestringPhone number
portrailstringProfile picture
deptsArray.<string>List of departments
imUserJidstringIM account
timeZonestringTime zone information
userTypenumberUser type3.9.0
Example
import { getUserInfo } from '@suplink/jssdk';
getUserInfo().then((res) => console.log(res))

openUserInfo

Definition
Open the user information page.
info

App version must V3.7.0 and later.

Parameter
AttributeTypeDescriptionRequired
staffCodestringUnique identifier for the staffYes
Response
AttributeTypeDescription
codestringResponse code: 200 for success, 404 for failure
msgstringResponse information
dataUnknownResponse data
Example
import { openUserInfo } from '@suplink/jssdk';
openUserInfo({ staffCode: '001' }).then((res) => console.log(res))

signature

Definition
Electrical signature.
Parameter
None.
Response
AttributeTypeDescription
codestringResponse code: 200 for success, 404 for failure
msgstringResponse information
dataObjectResponse data
data.imageBase64numberElectronic signature Base64
Example
import { signature } from '@suplink/jssdk';
signature().then((res) => console.log(res))

SDK Details-Data Cache

getStorage

Definition
Get cache data.
Parameter
AttributeTypeDescriptionRequired
keystringKey specified in the local storageYes
Response
AttributeTypeDescription
codestringResponse code: 200 for success, 404 for failure
msgstringResponse information
dataanyData from local storage
Example
import { getStorage } from '@suplink/jssdk';
getStorage({ key: 'name' }).then((res) => console.log(res))

setStorage

Definition
Save cache data.
Parameter
AttributeTypeDescriptionRequired
keystringKey specified in the local storageYes
valuestringValue to be storedYes
Response
AttributeTypeDescription
codestringResponse code: 200 for success, 404 for failure
msgstringResponse information
dataunknownResponse data
Example
import { setStorage } from '@suplink/jssdk';
setStorage({ key: 'name', value: 'bob' }).then((res) => console.log(res))

SDK Details-Interface

datePicker

Definition
Date picker.
info

App version must V3.3.0 and later.

Parameter
AttributeTypeDescriptionDefaultRequired
titlestringTitleNo
minnumberMinimum selectable date in milliseconds0No
maxnumberMaximum selectable date in milliseconds2556028800000No
valuenumberSelected date in millisecondsNo
showTimebooleanAdd time selection featuretrueNo
Response
AttributeTypeDescription
codestringResponse code: 200 for success, 404 for failure, 300 for cancel
msgstringResponse information
datanumberSelected date
Example
import { datePicker } from '@suplink/jssdk';
datePicker().then((res) => console.log(res))

dateRangePicker

Definition
Date range picker.
info

App version must V3.3.0 and later.

Parameter
AttributeTypeDescriptionDefaultRequired
valueArray.<number>Selected date range in milliseconds[0, 0]No
minnumberMinimum selectable date in milliseconds0No
maxnumberMaximum selectable date in milliseconds2556028800000No
showTimebooleanAdd time selection featuretrueNo
limitMinnumberMinimum time interval between start and end dates in millisecondsNo
limitMaxnumberMaximum time interval between start and end dates in millisecondsNo
Response
AttributeTypeDescription
codestringResponse code: 200 for success, 404 for failure, 300 for cancel
msgstringResponse information
dataObjectResponse data
data.resBeginDatenumberSelected start date
data.resEndDatenumberSelected end date
Example
import { dateRangePicker } from '@suplink/jssdk';
dateRangePicker().then((res) => console.log(res))

setNavigationBar

Definition
Set navigation bar.
Parameter
AttributeTypeDescriptionDefaultRequired
titlestringNavigation bar titleNo
backgroundColorstringNavigation bar background color, supports only hexadecimal colors#ffffffNo
backButtonbooleanWhether the back button is displayedtrueNo
themestringNavigation bar theme, dark: dark theme | light: light themedarkNo
goastbooleanWhether the navigation bar is floating and transparent, true: navigation bar background color is #646464 with 50% opacity, and backgroundColor is invalid (effective for SUPOS pages)falseNo
hiddenbooleanWhether the navigation bar is hiddenfalseNo
atomicBondbooleanWhether the atomic key in the upper right corner is displayedtrueNo
underlinebooleanWhether the navigation bar underline is displayedtrueNo
info

theme and goast are unavailable for web apps.

Response
AttributeTypeDescription
codestringResponse code: 200 for success, 404 for failure
msgstringResponse information
dataunknownResponse data
Example
import { setNavigationBar } from '@suplink/jssdk';
setNavigationBar({ title: 'suplink' }).then((res) => console.log(res))